package com.tddx.activiti.business.sys.service.systrole;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.tddx.activiti.base.BaseService;
import com.tddx.activiti.business.sys.dao.systrole.SysTroleDao;
import com.tddx.activiti.business.sys.dao.systrole.SysTroleJdbc;
import com.tddx.activiti.business.sys.entity.systrole.SysTroleEntity;
import com.tddx.activiti.business.sys.entity.systuser.SysTuserEntity;

/**
 * service layer 服务层 
 * @Auth yanweizhao 
*/
@Service
public class SysTroleService extends BaseService<SysTuserEntity, String>{

	@Autowired private SysTroleDao dao;

	@Autowired private SysTroleJdbc jdbc;

	public SysTroleEntity findOne(Long id){
		SysTroleEntity entity = dao.findOne(id);
		return entity;
	}
	
	public SysTroleEntity save(SysTroleEntity entity){
		entity = dao.saveAndFlush(entity);
		return entity;
	}
	
	public void delete(String ids){
		for(String idStr: ids.split(",")){
			Long id = Long.valueOf(idStr);
			SysTroleEntity entity = dao.findOne(id);
			entity.setVcDel("1");
		}
	}
	
	public Object findList(){
		List<SysTroleEntity> obj = jdbc.findListByCondition();
		return obj;
	}
}
